home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
System
/
Shutdown FX
/
Shutdown FX ƒ
/
sfx code ƒ
/
sfx main.c
< prev
next >
Wrap
Text File
|
1993-12-14
|
3KB
|
103 lines
/**********************************************************************\
File: sfx main.c
Purpose: This module handles the actual shutdown proc -- creating
a grafport on the screen and clearing it (dispatching
the graphic effects).
Shutdown FX -=- graphic effects on shutdown
Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program in a file named "GNU General Public License".
If not, write to the Free Software Foundation, 675 Mass Ave,
Cambridge, MA 02139, USA.
\**********************************************************************/
#include "sfx main.h"
#include "sfx init.h"
#include "globals.h"
#define NUM_WIPES 16
void sfxMain(void)
{
int oldMenuBarHeight;
long oldA5;
QDGlobals qd; /* our QD globals. */
GrafPort gp; /* our grafport. */
GrafPtr savePort;
int whichWipe;
THz saveZone;
int width, height;
unsigned long temp;
GetPort(&savePort);
oldMenuBarHeight=MBarHeight;
MBarHeight=0;
DrawMenuBar();
/* get a value for A5, a structure that mirrors qd globals. */
oldA5 = SetA5((long)&qd.end);
InitGraf(&qd.thePort);
OpenPort(&gp);
HideCursor();
width=gp.portRect.right-gp.portRect.left;
height=gp.portRect.bottom-gp.portRect.top;
GetDateTime(&temp);
whichWipe=(temp&0x7fffffff)%NUM_WIPES;
saveZone=GetZone();
SetZone(SysZone);
if (whichWipe==0) SpiralGyra(&qd.black, width, height);
else if (whichWipe==1) CircularWipe(&qd.black, width, height);
else if (whichWipe==2) BoxInWipe(&qd.black, width, height);
else if (whichWipe==3) Skipaline(&qd.black, width, height);
else if (whichWipe==4) RandomWipe(&qd.black, width, height);
else if (whichWipe==5) FullScrollUD(&gp, &qd.black, width, height);
else if (whichWipe==6) MrDo(&gp, &qd.black, width, height);
else if (whichWipe==7) MrDoOutdone(&gp, &qd.black, width, height);
else if (whichWipe==8) DiagonalWipe(&qd.black, width, height);
else if (whichWipe==9) BoxOutWipe(&qd.black, width, height);
else if (whichWipe==10) CircleSerendipity(&qd.black, width, height);
else if (whichWipe==11) FourCorner(&qd.black, width, height);
else if (whichWipe==12) HalvesScroll(&gp, &qd.black, width, height);
else if (whichWipe==13) RescueRaiders(&qd.black, width, height);
else if (whichWipe==14) SkipalineLR(&qd.black, width, height);
else if (whichWipe==15) SlideWipe(&gp, &qd.black, width, height);
// You would think a simple switch-case statement would suffice, but you would
// be mistaken. In fact, the analogous switch-case causes a crash on a Powerbook
// 100. This is most likely a THINK C bug; it is super-optimizing the switch-case
// so much that it no longer works on a 68000 machine. The series of if-then-elses
// is less elegant to the programmer, but more elegant to the user, since it
// doesn't crash. (:
SetZone(saveZone);
MBarHeight=oldMenuBarHeight;
ShowCursor();
ObscureCursor();
ClosePort(&gp);
SetA5(oldA5);
SetPort(savePort);
}